#include "Runtime.h"
#include <crtdbg.h>

void CRuntime::CheckMemory(bool bHighFrequency)
{
	int nDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
	nDbgFlag |= _CRTDBG_ALLOC_MEM_DF;	
	nDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
	if ( !bHighFrequency )
		nDbgFlag |= _CRTDBG_CHECK_EVERY_128_DF;
	else
		nDbgFlag |= _CRTDBG_CHECK_ALWAYS_DF;
	_CrtSetDbgFlag(nDbgFlag);
}

bool CRuntime::IsValidHeapPoint(void* pPoint)
{
	return _CrtIsValidHeapPointer(pPoint) == 1;
}

void CRuntime::CheckMemoryOverflow()
{
	_CrtCheckMemory();
}